import express from 'express';
import { getWords, getWord, createWord, updateWord, deleteWord } from '../controllers/wordController';
import { auth, checkRole } from '../middlewares/auth';

const router = express.Router();

// 获取所有单词
router.get('/', auth, getWords);

// 获取单个单词
router.get('/:id', auth, getWord);

// 创建单词
router.post('/', auth, checkRole(['admin']), createWord);

// 更新单词
router.put('/:id', auth, checkRole(['admin']), updateWord);

// 删除单词
router.delete('/:id', auth, checkRole(['admin']), deleteWord);

export default router; 